package sjtu.ist.warehouse4ws.action;

import java.util.Map;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class JumpAction extends ActionSupport{
	public String execute() throws Exception {
		String message="other";
		Subject currentUser = SecurityUtils.getSubject();
	//	System.out.println("---------公司id:"+currentUser.getSession().getAttribute("companyId"));
		if(currentUser.hasRole("user")){
			message="main1";
			}
		if(currentUser.hasRole("admin")){
			message="main2";
			}
		if(currentUser.hasRole("superadmin")){
			ActionContext ac=ActionContext.getContext();
			Map<String,Object> session=ac.getSession();
			
			String upload=(String)session.get("upload");
			if(upload!=null && upload.equals("1")){
				message="main3upload";
			}else{
				message="main3";
			}
			
			
		}
		return message;
	
		
	}
	
}
